package com.youxin.cpcenter.controller;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.youxin.busfoundation.bean.BaseRequestBean;
import com.youxin.busfoundation.bean.ResponseObject;
import com.youxin.busfoundation.bean.staticalchart.RequestStaticalOverviewBean;
import com.youxin.cpcenter.common.log.LogMethod;
import com.youxin.cpcenter.service.AdminIndexService;


/**
 * 
 * @ClassName: AdminIndexController 
 * @Description: 首页 
 * @author yingde.cao
 * @date 2017年12月21日 上午10:54:05 
 *
 */
@RestController
public class AdminIndexController extends BaseController{


	@Autowired
	private AdminIndexService adminIndexService;
	/**
	 * @Title: DataDistributionOverview 
	 * @Description: 数据总览
	 * @param @param request
	 * @param @param httpServletResponse
	 * @param @param bean
	 * @param @return
	 * @return ResponseObject
	 * @throws
	 */
	@LogMethod(id="ent.statical.overview",eventContent={})
	@RequestMapping(value = "/api/statistical/overview", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
	public ResponseObject dataStatisticalOverview(HttpServletRequest request, HttpServletResponse httpServletResponse,
			@RequestBody RequestStaticalOverviewBean bean) {
		try {
			return adminIndexService.getDataStatisticalOverview(bean);
		} catch (Exception e) {
			logger.error("/api/statistical/overview异常", e);
			return ResponseObject.systemError(e);
		}
	}
	/**
	 * @Title: citysChart 
	 * @Description: 城市分布统计
	 * @param @param request
	 * @param @param httpServletResponse
	 * @param @param bean
	 * @param @return
	 * @return ResponseObject
	 * @throws
	 */
	@LogMethod(id="ent.statistical.citys",eventContent={})
	@RequestMapping(value = "/api/statistical/citys", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
	public ResponseObject citysChart(HttpServletRequest request, HttpServletResponse httpServletResponse,
			@RequestBody BaseRequestBean bean) {
		try {
			return adminIndexService.getCitysStatisticalChart(bean);
		} catch (Exception e) {
			logger.error("/api/statistical/citys异常", e);
			return ResponseObject.systemError(e);
		}
	}
	/**
	 * 
	 * @Title: industryChart 
	 * @Description: 行业分布统计
	 * @param @param request
	 * @param @param httpServletResponse
	 * @param @param bean
	 * @param @return
	 * @return ResponseObject
	 * @throws
	 */
	@LogMethod(id="ent.statistical.industry",eventContent={})
	@RequestMapping(value = "/api/statistical/industry", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
	public ResponseObject industryChart(HttpServletRequest request, HttpServletResponse httpServletResponse,
			@RequestBody BaseRequestBean bean) {
		try {
			return adminIndexService.getIndustryStatisticalChart(bean);
		} catch (Exception e) {
			logger.error("/api/statistical/industry异常", e);
			return ResponseObject.systemError(e);
		}
	}

}
